{{"{% extends '::base.html.twig' %} "}}
{{"{% block module_name %}"}}{{ entity }}{{"{% endblock %}"}}
{{"{% block title %}"}}{{ entity }}{{" :: Listar{% endblock %}"}}
{{"{% block customScripts %}"}}
{{"<script src='{{ asset('bundles/EndorBundle/js/jquery.dataTables.min.js') }}'></script>"}}
{{"{% endblock %}"}}
{{"{% block body %}"}}
<h2>{{ entity }} :: Listar</h2>
<div class="widget_inside">
    <table class="records_list regular">
        <thead>
            <tr>
        {%- for field, metadata in fields %}
                {%- if loop.first %}
                    <!--<th>{{ field|capitalize }}</th>-->
                {%- else%}
                    <th>{{ field|capitalize }}</th>
                {%- endif%}
        {%- endfor %}
                    <th style="width: 100px;">Acciones</th>
                </tr>
            </thead>
            <tbody>
    {{ '{% for entity in entities %}' }}
                    <tr>

    {%- for field, metadata in fields %}
        {%- if loop.first and ('show' in actions) %}
                        <!--<td><a href="{{ "{{ path('"~ route_name_prefix ~"_show', { 'id': entity.id }) }}" }}">{{ '{{ entity.'~ field|replace({'_': ''}) ~' }}' }}</a></td>-->
        {%- elseif metadata.type in ['date', 'datetime'] %}

                        <td>{{ '{% if entity.'~ field|replace({'_': ''}) ~' %}{{ entity.'~ field|replace({'_': ''}) ~'|date(\'Y-m-d H:i:s\') }}{% endif%}' }}</td>

        {%- else %}

                        <td>{{ '{{ entity.'~ field|replace({'_': ''}) ~' }}' }}</td>

        {%- endif %}

        {%- if loop.last %}

                        <td>
                {%- include "views/others/actions.html.twig" %}
                            </td>

        {%- endif %}
    {%- endfor %}

                        </tr>
    {{ '{% endfor %}' }}
                    </tbody>
                </table>
        {% if 'new' in actions %}
                <div class="margin_top_15 right">
                    <a href="{{ "{{ path('"~ route_name_prefix ~"_new') }}" }}" class="blue button">Agregar</a>
                </div>
        {% endif %}
            </div>
<script>
$(document).ready(function(){
    $('.regular').dataTable();
});
</script>
{{"{% endblock %}"}}